using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace StockCrawler {
    public partial class MainMaster : System.Web.UI.MasterPage {
        protected void Page_Load(object sender, EventArgs e) {
            
        }

        protected void ASPxNavBar1_ItemClick(object source, DevExpress.Web.NavBarItemEventArgs e)
        {
            //MainContent.Controls.Clear();
            //ContentPlaceHolder mpContentPlaceHolder;
            //TextBox mpTextBox;
            //mpContentPlaceHolder =
            //    (ContentPlaceHolder)Master.FindControl("ContentPlaceHolder1");
            //if (mpContentPlaceHolder != null)
            //{
                
            //    mpTextBox = (TextBox)mpContentPlaceHolder.FindControl("TextBox1");
            //    if (mpTextBox != null)
            //    {
            //        mpTextBox.Text = "TextBox found!";
            //    }
            //}
            switch (e.Item.Index)
            {
                case 0:
                    //UserControl.ucStockList currUC = (UserControl.ucStockList)this.MainContent.FindControl("ucStockList");
                    //if (currUC != null)
                    //{
                    //    this.MainContent.Controls.Remove(currUC);
                    //    UserControl.ucTest uc1 = new UserControl.ucTest();        
                    //    this.MainContent.Controls.Add(uc1);
                    //}
                    //Session["index"] = 1;
                    Response.Redirect("Default.aspx?index=1");
                    break;
                case 1:
                    //UserControl.ucStockList uc2 = new UserControl.ucStockList();        
                    //MainContent.Controls.Add(uc2);
                    //Session["index"] = 2;
                    Response.Redirect("Default.aspx?index=2");
                    break;
            }
        }

        public void LoadControl()
        {
            UserControl.ucStockList uc1 = new UserControl.ucStockList();
            MainContent.Controls.Add(uc1);
        }
    }
}